import request from '../utils/request'

// 获取购物车数据
export function reqGetCartList() {
  return request({
    method: 'get',
    url: `/cart/cartList`,
  })
}

// 添加物品到购物车
export function reqPostAddToCart(skuID, skuNum) {
  return request({
    method: 'post',
    url: `/cart/addToCart/${skuID}/${skuNum}`,
  })
}

// 切换商品选中状态
export function reqCheckCart(skuID, isChecked) {
  return request({
    method: 'get',
    url: `/cart/checkCart/${skuID}/${isChecked}`,
  })
}

// 批量选中购物车
export function reqBatchCheckCart(skuIdList, isChecked) {
  return request({
    method: 'post',
    url: `/cart/batchCheckCart/${isChecked}`,
    data: skuIdList,
  })
}

// 批量删除购物车商品
export function reqBatchDelCart(skuIdList) {
  return request({
    method: 'post',
    url: '/cart/batchDeleteCart',
    data: skuIdList,
  })
  /* return request.delete('/cart/batchDeleteCart', {
    skuIdList,
  }) */
}

// 删除购物车商品单条
export function reqDelSigleGoods(skuId) {
  return request.delete(`/cart/deleteCart/${skuId}`)
}
